<?php
class retrieve_formbuilder_admin extends retrieve_base{

	private $module_display_options 	= array();
	
	/**
	* function produces abstract structure of modules db structure
	*
    * used to generate the table structure required abstract function that passes an abstract
	* representation of the desired table structure to the proper database module which will
	* interpet the abstract and convert it into a valid SQL Create table structure.
	*
	* @return Array list of abstract table definitions for this module
	*/
	function create_table(){
		$tables = array();
		/**
		* Table structure for table 'formbuilder_settings'
		*/
		$fields = array(
			array("fbs_identifier"			,"unsigned integer"			,"NOT NULL"	,"auto_increment"),
			array("fbs_client"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_label"				,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbs_ecommerce"			,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_pricingstructure"	,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_fixedprice"			,"double"					,"NOT NULL"	,"default '0'"),
			array("fbs_price_link"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbs_fieldcount"			,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_all_locations"		,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_set_inheritance"		,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_type"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_command"				,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbs_target_menu"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
//			array("fbs_override"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbs_life"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_grace"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_review"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbs_in_admin"			,"unsigned small integer"	,"NOT NULL"	,"default '0'")
		);
		$primary ="fbs_identifier";
		$tables[count($tables)] = array("formbuilder_settings", $fields, $primary);
		/**
		* Table structure for table 'formbuilder_settings'
		*/
		$fields = array(
			array("fbo_identifier"			,"unsigned integer"			,"NOT NULL"	,"auto_increment"),
			array("fbo_client"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbo_command"				,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbo_owner"				,"unsigned integer"			,"NOT NULL"	,"default '0'"),
		);
		$primary ="fbo_identifier";
		$tables[count($tables)] = array("formbuilder_override", $fields, $primary);
		/**
		* Table structure for table 'formbuilder_merge_map'
		*/
		$fields = array(
			array("fbmm_identifier"	,"unsigned integer"			,"NOT NULL"	,"auto_increment"),
			array("fbmm_setting"	,"unsigned integer"			,"NOT NULL"	,"default '0'"), // link to a settings record
			array("fbmm_client"		,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbmm_mapping"	,"varchar(255)"				,"NOT NULL"	,"default ''")
		);
		$primary ="fbmm_identifier";
		$tables[count($tables)] = array("formbuilder_merge_map", $fields, $primary);
		/**
		* Table structure for table 'formbuilder_module_map'
		*/
		$fields = array(
			array("fbmm_identifier"	,"unsigned integer"			,"NOT NULL"	,"auto_increment"),
			array("fbmm_setting"	,"unsigned integer"			,"NOT NULL"	,"default '0'"), // link to a settings record
			array("fbmm_client"		,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbmm_link_id"	,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbmm_module"		,"varchar(255)"				,"NOT NULL"	,"default ''")
		);
		$primary ="fbmm_identifier";
		$tables[count($tables)] = array("formbuilder_module_map", $fields, $primary);
		/**
		* Table structure for table 'formbuilder_field_map'
		*/
		$fields = array(
			array("fbfm_identifier"	,"unsigned integer"			,"NOT NULL"	,"auto_increment"),
			array("fbfm_setting"	,"unsigned integer"			,"NOT NULL"	,"default '0'"), // link to a settings record
			array("fbfm_client"		,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbfm_fieldname"	,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbfm_label"		,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbfm_type"		,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbfm_belongs"	,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbfm_labelpos"	,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbfm_rank"		,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbfm_map"		,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbfm_auto"		,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbfm_required"	,"unsigned small integer"	,"NOT NULL"	,"default '0'")
		);
		$primary ="fbfm_identifier";
		$tables[count($tables)] = array("formbuilder_field_map", $fields, $primary);
		/**
		* Table structure for table 'formbuilder_price'
		*/
		$fields = array(
			array("fbp_identifier"	,"unsigned integer"			,"NOT NULL"	,"auto_increment"),
			array("fbp_setting"		,"unsigned integer"			,"NOT NULL"	,"default '0'"), // link to a settings record
			array("fbp_client"		,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("fbp_value"		,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fbp_price"		,"double"					,"NOT NULL"	,"default '0'")
		);
		$primary ="fbp_identifier";
		$tables[count($tables)] = array("formbuilder_price", $fields, $primary);
		
		return $tables;
	}

	

	/**
	* call the initialisation function only when this module is created
	*/
	function create_client_details($parameters){
	}
		

}
?>